 //const base_url = 'http://192.168.2.12:8764' //本地
const base_url = 'https://www.szzn.group'  //生产
// const base_url = 'http://zkf.5gzvip.91tunnel.com' //测试

export function request(url, data, method){
	let authtoken = uni.getStorageSync('authtoken')
	uni.setStorageSync('base_url',base_url)
	return new Promise((resolve,reject)=>{
			uni.request({
				url: base_url+url,
				data,
				method: method || 'GET',
				header: {
					'Content-type': 'application/json',
					"Authori-zation": 'Bearer '+uni.getStorageSync('token') //这里的token指的是微信授权登录的token，用来判断小程序是否属于登录状态
				},
				dataType:'json',
				success:res => {
					// if(res.data.code != '200'){
					// 	uni.showToast({
					// 		title:res.data.msg,
					// 		duration:1300,
					// 		icon:"error"
					// 	})
					// }
					resolve(res)
				},
				fail:err => {
					console.log('err',err)
					reject(err)
				}
			});
		// }
		
	})
}
